package rapier.sso.common.exception;

public class RapierSsoException extends RuntimeException {
	private static final long serialVersionUID = 1L;
	/**
	 * 异常对应的错误类型
	 */
	private final ErrorType errorType;

	public RapierSsoException() {
		super();
		this.errorType = SystemErrorType.SYSTEM_ERROR;
	}

	public RapierSsoException(String msg) {
		super(msg);
		this.errorType = new CommonErrorType(msg);
	}
	
	public RapierSsoException(ErrorType errorType) {
		super(errorType.getMesg());
		this.errorType = errorType;
	}

	public RapierSsoException(String msg, Throwable cause) {
		super(msg, cause);
		this.errorType = new CommonErrorType(msg);
	}

	public RapierSsoException(ErrorType errorType, Throwable cause) {
		super(errorType.getMesg(), cause);
		this.errorType = errorType;
	}

	public ErrorType getErrorType() {
		return errorType;
	}
}
